home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / CIncludes / ColorPicker.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-17  |  3.2 KB  |  110 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ColorPicker.h
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. */
  16.  
  17. #ifndef __COLORPICKER__
  18. #define __COLORPICKER__
  19.  
  20.  
  21. #ifndef __QUICKDRAW__
  22. #include <Quickdraw.h>
  23. #endif
  24. /*    #include <Types.h>                                            */
  25. /*        #include <ConditionalMacros.h>                            */
  26. /*    #include <MixedMode.h>                                        */
  27. /*    #include <QuickdrawText.h>                                    */
  28.  
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32.  
  33. #if GENERATINGPOWERPC
  34. #pragma options align=mac68k
  35. #endif
  36.  
  37. #ifdef __CFM68K__
  38. #pragma lib_export on
  39. #endif
  40.  
  41.  
  42. enum {
  43. /*Maximum small fract value, as long*/
  44.     MaxSmallFract                = 0x0000FFFF
  45. };
  46.  
  47. /* A SmallFract value is just the fractional part of a Fixed number,
  48. which is the low order word.  SmallFracts are used to save room,
  49. and to be compatible with Quickdraw's RGBColor.  They can be
  50. assigned directly to and from INTEGERs. */
  51. /* Unsigned fraction between 0 and 1 */
  52. typedef unsigned short SmallFract;
  53.  
  54. /* For developmental simplicity in switching between the HLS and HSV
  55. models, HLS is reordered into HSL. Thus both models start with
  56. hue and saturation values; value/lightness/brightness is last. */
  57. struct HSVColor {
  58.     SmallFract                        hue;                        /*Fraction of circle, red at 0*/
  59.     SmallFract                        saturation;                    /*0-1, 0 for gray, 1 for pure color*/
  60.     SmallFract                        value;                        /*0-1, 0 for black, 1 for max intensity*/
  61. };
  62. typedef struct HSVColor HSVColor;
  63.  
  64. struct HSLColor {
  65.     SmallFract                        hue;                        /*Fraction of circle, red at 0*/
  66.     SmallFract                        saturation;                    /*0-1, 0 for gray, 1 for pure color*/
  67.     SmallFract                        lightness;                    /*0-1, 0 for black, 1 for white*/
  68. };
  69. typedef struct HSLColor HSLColor;
  70.  
  71. struct CMYColor {
  72.     SmallFract                        cyan;
  73.     SmallFract                        magenta;
  74.     SmallFract                        yellow;
  75. };
  76. typedef struct CMYColor CMYColor;
  77.  
  78. extern pascal SmallFract Fix2SmallFract(Fixed f)
  79.  THREEWORDINLINE(0x3F3C, 0x0001, 0xA82E);
  80. extern pascal Fixed SmallFract2Fix(SmallFract s)
  81.  THREEWORDINLINE(0x3F3C, 0x0002, 0xA82E);
  82. extern pascal void CMY2RGB(const CMYColor *cColor, RGBColor *rColor)
  83.  THREEWORDINLINE(0x3F3C, 0x0003, 0xA82E);
  84. extern pascal void RGB2CMY(const RGBColor *rColor, CMYColor *cColor)
  85.  THREEWORDINLINE(0x3F3C, 0x0004, 0xA82E);
  86. extern pascal void HSL2RGB(const HSLColor *hColor, RGBColor *rColor)
  87.  THREEWORDINLINE(0x3F3C, 0x0005, 0xA82E);
  88. extern pascal void RGB2HSL(const RGBColor *rColor, HSLColor *hColor)
  89.  THREEWORDINLINE(0x3F3C, 0x0006, 0xA82E);
  90. extern pascal void HSV2RGB(const HSVColor *hColor, RGBColor *rColor)
  91.  THREEWORDINLINE(0x3F3C, 0x0007, 0xA82E);
  92. extern pascal void RGB2HSV(const RGBColor *rColor, HSVColor *hColor)
  93.  THREEWORDINLINE(0x3F3C, 0x0008, 0xA82E);
  94. extern pascal Boolean GetColor(Point where, ConstStr255Param prompt, const RGBColor *inColor, RGBColor *outColor)
  95.  THREEWORDINLINE(0x3F3C, 0x0009, 0xA82E);
  96.  
  97. #ifdef __CFM68K__
  98. #pragma lib_export off
  99. #endif
  100.  
  101. #if GENERATINGPOWERPC
  102. #pragma options align=reset
  103. #endif
  104.  
  105. #ifdef __cplusplus
  106. }
  107. #endif
  108.  
  109. #endif /* __COLORPICKER__ */
  110.